
using System.ComponentModel;
using System;
using System.Collections;
using System.Diagnostics;
using System.IO;
using System.Reflection;

using CIndicators;
using CStock;
using CUtil;
using System.Collections.Generic;

namespace CStock
{
    /// <summary>
    /// this class is abstract mainly because of the ID property, which sets also the path,which has to be either 
    /// Daily or Intraday
    /// </summary>
    public abstract class DataProvider : StockObjectBase, IDataProvider
    {
        #region private members
        protected bool intraday = false;


        protected string intradayDateFileRead;

        [System.Xml.Serialization.XmlIgnoreAttribute()]
        protected IListQuotes oHLC;


        protected int totalNumberOverall;

        protected IList<double> seriesClose;
        protected IList<double> seriesOpen;
        protected IList<DateTime> seriesTime;
        protected IList<double> seriesHigh;
        protected IList<double> seriesLow;
        protected IList<double> seriesChange;
        protected IList<System.Int64> seriesVolume;



        protected ArrayList indicatorNames;
        protected ArrayList indicatorIntradayNames;
        protected IIndicators indicators;
        protected IIndicators indicatorsIntraday;
        protected ITradeStep tradeStepUser;
        protected IIndicator tradeSystemIndicator;


        protected IQuote lastTradedQuote = new Quote();


        protected IDataClassIntraday dataClassIntraday;


        //only important for DataClassDaily!!


        #endregion

        #region constructor  + init + delete

        public DataProvider()
        {

            this.indicators = new Indicators();
            this.oHLC = new ListQuotes();
            ResetCollections();

        }


        protected void ReinitializeStockData()
        {
            this.oHLC = null;
            this.SetNewCollections();

        }
        protected void SetNewCollections()
        {
            this.oHLC = new ListQuotes(this);

            this.seriesClose = new List<double>();
            this.seriesTime = new List<DateTime>();
            this.seriesHigh = new List<double>();
            this.seriesLow = new List<double>();
            this.seriesOpen = new List<double>();
            seriesChange = new List<double>();
            this.seriesVolume = new List<System.Int64>();

        }
        protected void DeleteAllCollections()
        {

            this.oHLC = null;
            this.seriesClose = null;
            this.seriesTime = null;
            this.seriesHigh = null;
            this.seriesLow = null;
            this.seriesOpen = null;
            this.seriesChange = null;
            this.seriesVolume = null;

            this.seriesTime = null;


        }



        #endregion

        #region Quotes Serialize - Save - Delete

      
        /// <summary>
        /// 
        /// </summary>
        public Quote[] QuoteCollectionArray
        {
            get
            {
                List<Quote> arrL = this.QuoteCollection as List<Quote>;

                if (arrL != null && arrL.Count > 0)
                    return (Quote[])arrL.ToArray();
                else
                    return null;
            }
            set
            {
                ResetCollections();
                for (int i = 0; i < value.Length; i++)
                {
                    IQuote q = value[i] as IQuote;
                    this.seriesTime.Add(q.DATE);
                    this.seriesOpen.Add(q.OPENc);
                    this.seriesClose.Add(q.CLOSEc);
                    this.seriesHigh.Add(q.HIGH);
                    this.seriesLow.Add(q.LOW);
                    this.seriesChange.Add(q.Change);

                    this.seriesVolume.Add(q.VOLUME);




                }


            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public static bool DeSerialize(IDataProvider myDataClass, bool intraday)
        {
            if (myDataClass == null)
            {
                System.Diagnostics.Debug.Assert(myDataClass != null, "DataClass = null, no data can be read");
                return false;
            }

            if (intraday)
            {
                Debug.Assert(false, "Not yet consistent implemented");
                return myDataClass.DeSerialize_IntradayPart();


            }
            else
            {
                object o = myDataClass;
                return myDataClass.DeSerialize(ref o);

            }



        }
        #endregion


        #region quotes helpers


        public double QuoteCurrent
        {
            get
            {
                if (this.seriesClose != null && this.seriesClose.Count > 0)
                {
                    return this.seriesClose[this.seriesClose.Count - 1];

                }
                return -10000;

            }
        }
        protected virtual void CheckQuoteCollection()
        {
            SetSeriesFromQuoteCollection(this.QuoteCollection);

        }

        protected bool RefreshOHLC()
        {
            if (this.seriesTime != null && this.seriesTime.Count > 0)
            {
                CreateQuoteCollectionFromDataSeries();
                return true;
            }
            return false;
        }


        #endregion
        

        #region Quotes

       


        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public IList<double> SeriesHigh
        {
            get
            {
                if (seriesTime.Count == 0)
                    CheckQuoteCollection();
                return this.seriesHigh;
            }
            set
            {
                this.seriesHigh = value;
            }
        }
        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public IList<double> SeriesLow
        {
            get
            {
                if (seriesTime.Count == 0)
                    CheckQuoteCollection();
                return this.seriesLow;
            }
            set
            {
                this.seriesLow = value;
            }
        }
        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public IList<DateTime> SeriesTime
        {
            get
            {
                if (seriesTime.Count == 0)
                    CheckQuoteCollection();
                return this.seriesTime;
            }
            set
            {
                this.seriesTime = value;
            }
        }


        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public IList<double> SeriesOpen
        {
            get
            {
                if (seriesTime.Count == 0)
                    CheckQuoteCollection();
                return this.seriesOpen;
            }
            set
            {
                this.seriesOpen = value;
            }
        }

        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public IList<double> SeriesClose
        {
            get
            {
                if (seriesTime.Count == 0)
                    CheckQuoteCollection();
                return this.seriesClose;
            }
            set
            {
                this.seriesClose = value;
            }
        }
        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public IList<double> SeriesChange
        {
            get
            {
                if (seriesTime.Count == 0)
                    CheckQuoteCollection();
                return this.seriesChange;
            }
            set
            {
                this.seriesChange = value;
            }
        }
        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public IList<System.Int64> SeriesVolume
        {
            get
            {
                if (seriesTime.Count == 0)
                    CheckQuoteCollection();
                return this.seriesVolume;
            }
            set
            {
                this.seriesVolume = value;
            }
        }

        public IListQuotes QuotesChart(CStock.IConfiguration config)
        {
            IListQuotes qc;
            if (config.IntradayModus)
            {
                IDataClassDaily dcd = this as IDataClassDaily;
                Debug.Assert(dcd != null, "Software error : dataClass Intraday conversion");
                qc = dcd.DataClassIntraday.QuoteCollection;
                return qc;
            }

            qc = QuoteCollection;

            if (qc == null || qc.Count <= 0)
                return qc;

            if (config.IntradayModus)
            {
                return qc;
            }
            else
            {
                if (ProgramContext.Instance.Configuration.ProgramMode == ProgramModes.Realtime)
                {
                    return qc;
                }
                else
                {
                    DateTime dtStart = config.Dates.DateMinChartSilent;
                    DateTime dtStop = config.Dates.DateMaxChartCurrent;
                    int iStart = qc.IndexOf(dtStart);
                    if (iStart < 0)
                        iStart = 0;
                    int iEnd = qc.IndexOf(dtStop);
                    if (iEnd < 0)
                        iEnd = qc.Count - 1;
                    IListQuotes qcReturn = new ListQuotes(this);
                    for (int i = iStart; i <= iEnd; i++)
                    {
                        qcReturn.Add(qc[i]);

                    }
                    return qcReturn;
                }

            }



        }
      
        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public IListQuotes QuoteCollection
        {
            get
            {
                try
                {
                    if (this.oHLC == null || this.oHLC.Count <= 0)
                    {
                        if (RefreshOHLC())
                            return this.oHLC;


                    }
                    return this.oHLC;

                }
                catch (Exception exc)
                {
                    Debug.Assert(false, "Error getting quotes for " + this.Name, exc.Message);
                    return this.oHLC;

                }
            }
            set
            {
                this.oHLC = value;

            }
        }
        public bool SetSeriesFromQuoteCollection(IListQuotes quColl)
        {
            if (seriesTime.Count == 0)
            {
                ResetCollections();
                for (int i = 0; i < quColl.Count; i++)
                {
                    IQuote q = quColl[i] as IQuote;
                    this.seriesTime.Add(q.DATE);
                    this.seriesOpen.Add(q.OPENc);
                    this.seriesClose.Add(q.CLOSEc);
                    this.seriesHigh.Add(q.HIGH);
                    this.seriesLow.Add(q.LOW);
                    this.seriesChange.Add(q.Change);
                    this.seriesVolume.Add(q.VOLUME);




                }
            }
            return true;

        }
  
        protected void ResetCollections()
        {
            this.oHLC = new ListQuotes(this);
            this.seriesTime = new List<DateTime>();
            this.seriesOpen = new List<double>();
            this.seriesClose = new List<double>();
            this.seriesHigh = new List<double>();
            this.seriesLow = new List<double>();
            this.seriesChange = new List<double>();
            this.seriesVolume = new List<System.Int64>();


        }

        //
        public int IndexOf(DateTime dt)
        {

            int i = -1;
            for (i = this.oHLC.Count - 1; i > -1; i--)
            {
                if (this.oHLC[i].DATE == dt)
                {
                    return i;
                }
            }
            return i;


        }
        protected static int IndexFindGreaterThan(DateTime dt, IListQuotes qc)
        {
            int i = -1;


            for (i = 0; i < qc.Count; i++)
            {
                if (qc[i].DATE >= dt)
                {
                    return i;

                }
            }


            return i;
        }
        public int IndexFindGreaterThan(DateTime dt)
        {

            return IndexFindGreaterThan(dt, this.oHLC);


        }
        public int IndexFindSmallerThanStartEnd(DateTime dt)
        {

            return IndexFindSmallerThanStartEnd(dt, this.oHLC);



        }
        protected static int IndexFindSmallerThanStartEnd(DateTime dt, IListQuotes qc)
        {

            int i = -1;
            for (i = qc.Count - 1; i > -1; i--)
            {
                if (qc[i].DATE <= dt)
                {
                    return i;
                }
            }

            return i;

        }

        public DateTime DateOf(int index)
        {

            return DateOf(index, this.oHLC);


        }
        protected static DateTime DateOf(int index, IListQuotes qc)
        {

            if (qc.Count > 0)
            {
                return qc[index].DATE;
            }
            else
            {
                return new DateTime(1900, 01, 01);
            }

        }
        protected void CheckIntradayQuoteCollection()
        {
            if (this.seriesTime == null)
            {
                DeSerialize_IntradayPart();
            }
        }



        protected void AddSingleQuoteToSeries(IQuote q)
        {


            this.seriesOpen.Add(q.OPENc);
            this.seriesClose.Add(q.CLOSEc);
            this.seriesHigh.Add(q.HIGH);
            this.seriesLow.Add(q.LOW);
            this.seriesTime.Add(q.DATE);
            this.seriesChange.Add(q.Change);
            this.seriesVolume.Add(q.VOLUME);
        }
        protected void CreateSeries_FromQuoteCollection()
        {
            //check if data is there
            //this will cause a GetFromXML
            SetNewCollections();

            if (this.oHLC != null || this.oHLC.Count != 0)
            {
                for (int i = 0; i < this.oHLC.Count; i++)
                {
                    IQuote q = this.oHLC[i] as IQuote;

                    AddSingleQuoteToSeries(q);
                }


            }
        }

        protected void CreateQuoteCollectionFromDataSeries()
        {
            //check if data is there
            //this will cause a GetFromXML

            if (this.oHLC == null || this.oHLC.Count == 0)
            {
                IList<DateTime> dt = this.seriesTime;
                if (dt != null)
                {
                    for (int i = 0; i < dt.Count; i++)
                    {
                        IQuote q = new Quote();
                        if (this.seriesClose.Count > i)
                            q.CLOSEc = this.seriesClose[i];
                        if (this.seriesTime.Count > i)
                            q.DATE = this.seriesTime[i];
                        //only open and close are mandatory
                        if (this.seriesOpen.Count > i)
                            q.OPENc = this.seriesOpen[i];

                        if (this.seriesHigh.Count > i)
                            q.HIGH = this.seriesHigh[i];
                        if (this.seriesLow.Count > i)
                            q.LOW = this.seriesLow[i];
                        if (this.seriesChange.Count > i)
                            q.Change = this.seriesChange[i];

                        if (this.seriesVolume.Count > i)
                            q.VOLUME = this.seriesVolume[i];

                        this.oHLC.Add(q);


                    }
                }
            }
        }
        protected void CreateQuoteCollectionFromDataSeries_Intraday()
        {
            //check if data is there
            //this will cause a ReadQuoteCollection

            if (this.oHLC == null || this.oHLC.Count == 0)
            {
                IList<DateTime> dt = this.seriesTime;
                if (dt != null)
                {
                    for (int i = 0; i < dt.Count; i++)
                    {
                        IQuote q = new Quote();
                        q.CLOSEc = this.seriesClose[i];
                        q.OPENc = this.seriesOpen[i];
                        q.DATE = this.seriesTime[i];
                        this.oHLC.Add(q);


                    }
                }
            }
        }


        #endregion

        #region intraday

        /// <summary>
        /// this property is set on class creation and cannot be changed from outside
        /// </summary>
        public bool Intraday
        {
            get
            {
                return this.intraday;
            }

        }

        public bool DeSerialize_IntradayPart()
        {
            DataClassIntraday dci = new DataClassIntraday(this);
            dci.Parent = (IDataItem)this.parent;
            object o1 = dci;

            if (this.dataClassIntraday.DeSerialize(ref o1))
            {
                this.dataClassIntraday = o1 as DataClassIntraday;
                this.dataClassIntraday.ResetParent(this);
            }
            else
            {
                //Debug.Assert(false, "Error deserializing Intraday " + this.ID);
                return false;
            }
            return true;
        }


        #endregion

        #region object overrides

        //		public object Clone()
        //		 {
        //			 //Share is lowest common Element
        //			 return this.MemberwiseClone();
        //		 }
        public new IDataProvider Clone()
        {
            //Share is lowest common Element
            return this.MemberwiseClone() as IDataProvider;
        }

        public int CompareTo(object compareObject)
        {
            return this.ToString().CompareTo(((DataClass)compareObject).ToString());
        }


        public override string ToString()
        {
            return this.Name;
            //return this.GetParameterValue(1).ToString().Trim();
        }

        public override int GetHashCode()
        {
            return ("DataClass" + this.ID).GetHashCode();
            // return ("DataClass" + this.iD);
        }
        #endregion

        #region others methods
        public override bool Delete()
        {
            try
            {
                string fileName = this.path + "\\" + this.iD + ".xml";

                System.IO.File.Delete(fileName);
                string dirName = this.path + "\\" + this.iD;
                System.IO.Directory.Delete(dirName, true);
                return true;




            }
            catch (Exception ex)
            {
                Debug.Assert(false, "Error deleting " + this.iD + "; " + ex.Message);
                return false;
            }

        }




        #endregion

        #region other props

        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public new IDataItem Parent
        {
            get
            {

                return this.parent as IDataItem;

            }
            set
            {
                this.parent = value as IStockObjectBase;
            }
        }
        public int TotalNumberOverall
        {
            get
            {
                return this.totalNumberOverall;

            }
            set
            {
                this.totalNumberOverall = value;
            }
        }


        #endregion

        #region Indicators properties






        [Browsable(false)]
        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public ArrayList IndicatorNames
        {
            get
            {
                if (indicatorNames == null)
                {
                    indicatorNames = Get_Indicators_Calculated_Names();

                }
                return this.indicatorNames;

            }
            set
            {
                indicatorNames = value;
            }
        }


        [Browsable(false)]
        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public ArrayList IndicatorIntradayNames
        {
            get
            {
                if (indicatorIntradayNames == null)
                {
                    indicatorIntradayNames = Get_Indicators_Calculated_Names();

                }
                return this.indicatorIntradayNames;

            }
            set
            {
                indicatorIntradayNames = value;
            }
        }



        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public IIndicators IndicatorsChecked
        {
            get
            {

                this.indicators = DataClass.Get_Indicators_Computed(this);
                return this.indicators;
            }
            set
            {
                this.indicators = value;
            }

        }
        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public IIndicators IndicatorsIntraday
        {
            get
            {
                if (this.indicatorsIntraday == null || this.indicators.Count < 1)
                {
                    IIndicators indTemp = this.indicators;

                    this.indicators = DataClass.Get_Indicators_Computed(this);
                    indicatorsIntraday = this.indicators;
                    this.indicators = indTemp;

                }
                //availableIndicators = GetAvailableIndicators();
                return this.indicatorsIntraday;
            }
            set
            {
                this.indicatorsIntraday = value;
            }

        }


        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public IIndicator TradeSystemIndicator
        {
            get
            {
                return this.tradeSystemIndicator;
            }
            set
            {
                this.tradeSystemIndicator = value;
            }

        }


        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public IIndicators IndicatorsJustGetEm
        {
            get
            {

                return this.indicators;
            }
            set
            {
                this.indicators = value;
            }

        }

        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public IIndicators IndicatorsUnchecked
        {
            get
            {
                if (this.indicators == null || this.indicators.Count < 1)
                {

                    this.indicators = DataClass.Get_Indicators_Computed(this);
                }
                //availableIndicators = GetAvailableIndicators();
                return this.indicators;
            }
            set
            {
                this.indicators = value;
            }

        }


        #endregion

        #region indicator methods

        public IIndicator CreateIndicator(string indName)
        {

            IIndicator indInput = new CIndicators.Indicator();
            int interval = CUtil.IOUtil.GetIntervalFromNameWithInterval(indName);

            indInput.NameBase = CUtil.IOUtil.GetNameBaseFromNameWithInterval(indName);
            indInput.Interval = interval;
            indInput.Parent = this;

            //IIndicator ind = CIndicators.IndEvaluator.Indicator_Evaluate(indInput);
            IIndicator ind = CIndicators.IndEvaluator.Indicator_XMLOrEvaluate(indInput);

            if (ind != null)
            {

                if (!this.indicators.Contains(ind))
                    this.indicators.Add(ind);
            }
            return ind;

        }
        public bool ComputeIndicators_Profile(IProfile myprofile)
        {
            try
            {
                if (myprofile.ChartLine != null)
                {
                    for (int i = 0; i < myprofile.ChartLine.Count; i++)
                    {
                        ChartLine cl = myprofile.ChartLine[i];
                        if (!cl.IsEquity)
                        {
                            string indName = cl.IndicatorOrShareName;
                            if (Get_Check_IndicatorByName(indName) == null)
                            {
                                System.Windows.Forms.MessageBox.Show("Indicator configuration error: Indicator cannot be shown: " + indName);
                                //System.Diagnostics.Debug.WriteLine("Indicator not OK : " + indName);
                                //return false;
                            }
                        }




                    }
                }
                return true;
            }
            catch (Exception ex)
            {
                Debug.Assert(false, "Error computing Indicators for Profile: " + ex.Message);
                return false;
            }
        }
        /// <summary>
        /// gets the already computed indicators
        /// </summary>
        /// <param name="indColl"></param>
        protected IIndicator Get_Check_IndicatorByName(string name)
        {
            try
            {
                IIndicator ind = indicators[name];
                if (ind != null)
                {
                    if (ind.ValuesUnchecked.Count != this.QuoteCollection.Count)
                    {
                        //ind.Evaluate();
                        ind = IndEvaluator.Indicator_XMLOrEvaluate(ind);
                        //indicators.Add(ind);
                    }
                }
                else
                {
                    //already added
                    ind = CreateIndicator(name);


                }
                return ind;
            }
            catch (Exception ex)
            {
                Debug.Assert(false, "Error checking indicator: " + name + " ; " + ex.Message);
                return null;
            }

        }
        private static IIndicators GetIndicators(IDataProvider mydataClass, ArrayList myComputedIndicatorNamesWithIntervals)
        {
            IIndicators myInds = new Indicators();
            //System.Diagnostics.Debug.Assert(myNames != null,"no indicator names could be found");
            IIndicators col = CIndicators.IndEvaluator.Indicators_Computed
                (mydataClass, myComputedIndicatorNamesWithIntervals);
            if (col != null)
            {
                for (int i = 0; i < col.Count; i++)
                {
                    IIndicator ind = col[i] as IIndicator;
                    if (ind.Values.Count != mydataClass.QuoteCollection.Count)
                    {
                        if (ind.NameBase == "InterestCB")
                        {
                            ind = InterestCB.Instance;
                        }
                        if (ind.NameBase == "NewsYield")
                        {
                            ind = NewsYield.Instance;
                        }
                        if (!ind.Recalculate())
                            return null;
                    }
                    myInds.Add(ind);
                }
            }
            else
            {
                //MessageBox.Show("There are no computed indicators for this item, please select some using the Indicator selection dialog");

            }
            return myInds;
        }
        protected static IIndicators Get_Indicators_Computed(IDataProvider mydataClass)
        {
            try
            {


                ArrayList myComputedIndicatorNamesWithIntervals =
                    IndEvaluator.GetSavedIndicators(mydataClass, ProgramContext.Instance.TradeEconomy.Path + "\\Indicators");


                if (myComputedIndicatorNamesWithIntervals == null
                    || myComputedIndicatorNamesWithIntervals.Count == 0)
                {
                    return null;
                }
                else
                {
                    IIndicators myInds = GetIndicators(mydataClass, myComputedIndicatorNamesWithIntervals);
                    return myInds;
                }
            }
            catch (Exception ex)
            {
                Debug.Assert(false, "Error getting computed indicators : " + ex.Message);
                return null;
            }


        }


        public void ReEvaluates()
        {
            if (this.indicators == null || indicators.Count < 1)
            {
                //no indicators to re-evaluate !
                return;
            }
            for (int i = 0; i < this.indicators.Count; i++)
            {
                IIndicator ind = this.indicators[i] as IIndicator;
                //string str = this.indicatorNames[i] as string;
                if (!IndEvaluator.RefreshIndicator(true, ref ind, this.oHLC))
                {
                    System.Windows.Forms.MessageBox.Show("Error refreshing indicator " + ind.ID);
                }


            }

        }

        public IIndicator Get_Indicator_ByName(string indFullName)
        {
            for (int i = 0; i < this.indicators.Count; i++)
            {
                IIndicator ind = this.indicators[i];
                if (ind.Name == indFullName)
                    return ind;
            }
            return null;

        }
        protected ArrayList Get_Indicators_Calculated_Names()
        {
            ArrayList newIndicatorNamesCalculated = new ArrayList();
            //Check whether the directory exists
            string d;
            if (this.intraday)
            {
                d = this.path + "\\Intraday";
            }
            else
            {
                d = this.path + "\\Daily";
            }

            if (!Directory.Exists(d))
            {
                return null;
            }
            //Check Directory for existing Files
            DirectoryInfo dir = new DirectoryInfo(d);
            foreach (FileInfo file in dir.GetFiles("*.xml"))
            {
                string s = file.Name;
                s = s.Remove(file.Name.Length - 4, 4);
                newIndicatorNamesCalculated.Add(s);
            }

            //sort the list
            newIndicatorNamesCalculated = CUtil.CollectionUtils.SortArrayList(newIndicatorNamesCalculated);
            return newIndicatorNamesCalculated;
        }




        #endregion

        #region trading


        public bool Get_Indicators_ForTradeSystem(bool refresh, ITradeSystem ts)
        {
            try
            {
                this.indicators = Indicators.EvaluatesForTradeSystem(refresh, this, ts);
                if (this.indicators == null || this.indicators.Count < 1)
                    return false;

                //IIndicators myInds = DataClass.Get_Indicators_Computed(this);

                //for (int i = 0; i < myInds.Count; i++)
                //{
                //    IIndicator ind = myInds[i] as IIndicator;
                //    if (!this.indicators.Contains(ind))
                //    {
                //        this.indicators.Add(ind);
                //    }

                //}
                return true;
            }
            catch (Exception ex)
            {
                Debug.Assert(false, "Error getting indicators " + ex.Message);
                return false;
            }
        }

        #endregion

        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public IDataClassIntraday DataClassIntraday
        {
            get
            {
                if (dataClassIntraday == null)
                {
                    dataClassIntraday = new DataClassIntraday(this);
                }
                return this.dataClassIntraday;
            }
            set
            {
                this.dataClassIntraday = value;
            }
        }

    }
}
